1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to image encoding, and more particularly, to image quantization which is performed elaborately by applying a predetermined color distortion removing quantization matrix to a block that has a high possibility of having color distortion.
2. Description of the Related Art
A digital image signal is divided into blocks of a predetermined size, e.g., 8×8 blocks, in a spatial domain to be transformed into a frequency domain using discrete cosine transforms (DCTs). In general, since the human visual system is sensitive to low-frequency components, quantization is performed on the digital image signal using a quantization matrix based on the characteristics of the human visual system and compression efficiency in image compression standards such as the Moving Picture Experts Group (MPEG) standard.
A color signal includes a luminance signal indicating brightness characteristics of the color signal and a chrominance signal indicating color characteristics of the color signal. In related art methods such as the MPEG-2 standard, the same DCT transformation matrix is applied to both the luminance signal and the chrominance signal. For example, if an input 8×8 block is X, an 8×8 DCT transformation matrix is C, and Y is a DCT-transformed matrix based on an 8×8 block based DCT transformation, a forward DCT is defined as Y=CXCT and C is defined as follows:
                              C          =                      [                                                                                C                    4                                                                                        C                    4                                                                                        C                    4                                                                                        C                    4                                                                                        C                    4                                                                                        C                    4                                                                                        C                    4                                                                                        C                    4                                                                                                                    C                    1                                                                                        C                    3                                                                                        C                    5                                                                                        C                    7                                                                                        -                                          C                      7                                                                                                            -                                          C                      5                                                                                                            -                                          C                      3                                                                                                            -                                          C                      1                                                                                                                                        C                    2                                                                                        C                    6                                                                                        -                                          C                      6                                                                                                            -                                          C                      2                                                                                                            -                                          C                      2                                                                                                            -                                          C                      6                                                                                                            C                    6                                                                                        C                    2                                                                                                                    C                    3                                                                                        -                                          C                      7                                                                                                            -                                          C                      1                                                                                                            -                                          C                      5                                                                                                            C                    5                                                                                        C                    1                                                                                        C                    7                                                                                        -                                          C                      3                                                                                                                                        C                    4                                                                                        -                                          C                      4                                                                                                            -                                          C                      4                                                                                                            C                    4                                                                                        C                    4                                                                                        -                                          C                      4                                                                                                            -                                          C                      4                                                                                                            C                    4                                                                                                                    C                    5                                                                                        -                                          C                      1                                                                                                            C                    7                                                                                        C                    3                                                                                        -                                          C                      3                                                                                                            -                                          C                      7                                                                                                            C                    1                                                                                        -                                          C                      5                                                                                                                                        C                    6                                                                                        -                                          C                      2                                                                                                            C                    2                                                                                        -                                          C                      6                                                                                                            -                                          C                      6                                                                                                            C                    2                                                                                        -                                          C                      2                                                                                                            C                    6                                                                                                                    C                    7                                                                                        -                                          C                      5                                                                                                            C                    3                                                                                        -                                          C                      1                                                                                                            C                    1                                                                                        -                                          C                      3                                                                                                            C                    5                                                                                        -                                          C                      7                                                                                            ]                          ⁢                                  ⁢                  (                                                    C                n                            =                              cos                ⁡                                  (                                      n                    ⁢                                                                                  ⁢                                          π                      /                      16                                                        )                                                      ,                          n              =              1                        ,            …            ⁢                                                  ,            7                    )                                    (        1        )            
According to the MPEG-2 standard, the same quantization matrix is used to quantize both a luminance signal and a chrominance signal that are sampled at a ratio of 4:2:0 and then undergo transformation to the frequency domain using DCTs. For example, a quantization matrix such as Equation 2 shown below is applied to a DCT coefficient block of intrapredicted luminance and chrominance signals and a quantization matrix such as Equation 3 shown below is applied to a DCT coefficient block of interpredicted luminance and chrominance signals.
                    [                                            8                                      16                                      19                                      22                                      26                                      27                                      29                                      34                                                          16                                      16                                      22                                      24                                      27                                      29                                      34                                      37                                                          19                                      22                                      26                                      27                                      29                                      34                                      34                                      38                                                          23                                      22                                      26                                      27                                      29                                      34                                      37                                      40                                                          22                                      26                                      27                                      29                                      32                                      35                                      40                                      48                                                          26                                      27                                      29                                      32                                      35                                      40                                      48                                      58                                                          26                                      27                                      29                                      34                                      38                                      46                                      56                                      69                                                          27                                      29                                      35                                      38                                      46                                      56                                      69                                      83                                      ]                            (        2        )                                [                                            16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                                          16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                                          16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                                          16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                                          16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                                          16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                                          16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                                          16                                      16                                      16                                      16                                      16                                      16                                      16                                      16                                      ]                            (        3        )            
FIG. 1A is a view illustrating a frame DCT method according to the related art and FIG. 1B is a view illustrating a field DCT method according to the prior art.
Referring to FIG. 1A, in the frame DCT method, an entire input 8×8 block is directly transformed to the frequency domain using DCT, i.e., even-numbered rows and odd-numbered rows of the input block are transformed as a whole. Referring to FIG. 1B, in the field DCT method, an input 8×8 block is divided into even-numbered fields composed of even-numbered rows and odd-numbered fields composed of odd-numbered rows and the transformations to the frequency domain using DCT's on the even-numbered fields and the odd-numbered fields are carried out separately.
In the MPEG-2 standard, a chrominance signal sampled at a ratio of 4:2:0 is transformed using DCT using the frame DCT method at all times. However, when this chrominance signal is presented in an interlaced format, if chrominance signals change significantly between fields, the occurrence of color distortion is inevitable.
For example, it is assumed that an input 8×8 color block X has a characteristic in which there exists a large difference between fields, i.e., pixel values of even-numbered rows and pixel values of odd-numbered rows are as follows:
                    X        =                  [                                                    170                                            170                                            170                                            170                                            170                                            170                                            170                                            170                                                                    30                                            30                                            30                                            30                                            30                                            30                                            30                                            30                                                                    170                                            170                                            170                                            170                                            170                                            170                                            170                                            170                                                                    30                                            30                                            30                                            30                                            30                                            30                                            30                                            30                                                                    170                                            170                                            170                                            170                                            170                                            170                                            170                                            170                                                                    30                                            30                                            30                                            30                                            30                                            30                                            30                                            30                                                                    170                                            170                                            170                                            170                                            170                                            170                                            170                                            170                                                                    30                                            30                                            30                                            30                                            30                                            30                                            30                                            30                                              ]                                    (        4        )            
After the input block X is transformed using DCT and quantized, inverse quantization and inverse DCT are performed on the DCT-transformed and quantized block, thereby generating a reconstructed block X′ as follows:
                              X          ′                =                  [                                                    139                                            139                                            139                                            139                                            139                                            139                                            139                                            139                                                                    38                                            38                                            38                                            38                                            38                                            38                                            38                                            38                                                                    225                                            225                                            225                                            225                                            225                                            225                                            225                                            225                                                                    0                                            0                                            0                                            0                                            0                                            0                                            0                                            0                                                                    246                                            246                                            246                                            246                                            246                                            246                                            246                                            246                                                                    1                                            1                                            1                                            1                                            1                                            1                                            1                                            1                                                                    188                                            188                                            188                                            188                                            188                                            188                                            188                                            188                                                                    87                                            87                                            87                                            87                                            87                                            87                                            87                                            87                                              ]                                    (        5        )            
Referring to Equation 4 and Equation 5, when DCT, quantization, inverse quantization, and inverse DCT are performed on a block such as the input block X in which there is a large difference between pixel values of the fields, the amount of change between pixel values of fields of the reconstructed block X′ increases even more, thereby causing color distortion. Such color distortion becomes worse during up-scaling and deinterlacing of the chrominance signal at a decoder side.